#define _CRT_SECURE_NO_WARNINGS 1

#include"string.h"

namespace bit
{
	void teststring1()
	{
		string s1("hello world");
		cout << s1.c_str() << endl;

		string::iterator it1 = s1.begin();
		while (it1 != s1.end())
		{
			cout << *it1 << " ";
			it1++;
		}
		cout << endl;


		for (auto e : s1)
		{
			cout << e;
		}
	}

	void teststring2()
	{
		string s1("hello world");

		s1.push_back('x');
		cout << s1.c_str() << endl;

		s1.append("x");
		cout << s1.c_str() << endl;

		s1.append("yyyyy");
		cout << s1.c_str() << endl;

		s1 += 'u';
		cout << s1.c_str() << endl;
		s1 += "zzzz";
		cout << s1.c_str() << endl;
	}

	void teststring3()
	{
		string s1("hello world");

		//s1.insert(6, 'x');
		//cout << s1.c_str() << endl;

		s1.insert(6, "yyy");
		cout << s1.c_str() << endl;
	}

}



int main()
{
	//bit::teststring1();
	//bit::teststring2();
	//bit::teststring3();

	int area;
	float weight, price = 0.0;
	scanf("%d %f", &area, &weight);

	if (area < 0 || area>4)
	{
		cout << "E I A" << endl;
	}
	else if (area == 0)
	{
		if (weight < 1)
		{
			price = 10;
		}
		else
		{
			weight = ceil(weight);
			price = 10 + (weight - 1) * 3;
		}
	}
	else if (area == 1)
	{
		if (weight < 1)
		{
			price = 10;
		}
		else
		{
			weight = ceil(weight);
			price = 10 + (weight - 1) * 4;
		}
	}
	else
	{
		if (weight < 1)
		{
			price = 15;
		}
		else
		{
			if (area == 2)
			{
				weight = ceil(weight);
				price = 15 + (weight - 1) * 5;
			}
			else if (area == 3)
			{
				weight = ceil(weight);
				price = 15 + (weight - 1) * 6.5;
			}
			else
			{
				weight = ceil(weight);
				price = 15 + (weight - 1) * 10;
			}
		}

	}
	printf("%.2f\n", price);
	return 0;
}